package com.example.manage_dzensaas.config;

import com.github.xiaoymin.knife4j.solon.extension.OpenApiExtensionResolver;
import io.swagger.models.Scheme;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject;
import org.noear.solon.docs.DocDocket;
import org.noear.solon.docs.models.ApiContact;
import org.noear.solon.docs.models.ApiInfo;

import javax.xml.transform.Result;

/**
 * @author wangzhiqi
 * @version 1.0
 * @description: Swagger配置类
 * @date 2025/1/9 18:47
 */
@Configuration
public class DocConfig {

    // knife4j 的配置，由它承载
    @Inject
    OpenApiExtensionResolver openApiExtensionResolver;

    /**
     * 丰富点的
     */
    @Bean("adminApi")
    public DocDocket adminApi() {
        //根据情况增加 "knife4j.setting" （可选）
        return new DocDocket()
                .vendorExtensions(openApiExtensionResolver.buildExtensions())
                .groupName("管理端接口")
                .basePath("/manage250214")
                .info(new ApiInfo().title("文档说明")
                        .description("鼎赞SAAS管理接口")
                        .termsOfService("https://gitee.com/noear/solon")
                        .contact(new ApiContact()
                                .name("wangzhiqi")
                                .url("https://gitee.com/noear/solon")
                                .email("demo@foxmail.com"))
                        .version("1.0"))
                .schemes(String.valueOf(Scheme.HTTP), String.valueOf(Scheme.HTTPS))
                .globalResponseInData(true)
                .globalResult(Result.class)
                .apis("com.example.manage_dzensaas.controller"); //可以加多条，以包名为单位
    }
}
